<?php
namespace Home\Controller;
/**
 * 前台首页控制器
 */
class PicturesController extends HomeController {
	//系统首页
    public function index($cate_id = null){
    	if($cate_id==null)$cate_id=6;//一列站几个colum
    	$cate_num=12/$cate_id;//显示列数
        $this->assign('_pictures', $this->getTurnPictures1('默认',$cate_num));
        $this->assign("_cateid",$cate_id);
        $this->display();
    }
    
    public function getTurnPictures1($type=null,$cate_num = null)
    {
    	$map['type']=$type;
    	$picInfo=M('PictureTurn')->where($map)->select();
    	for ($i=0; $i<count($picInfo); $i++)
    	{
    		$picInfo[$i]['rownum']=$i;
    		$picInfo[$i]['rownum2']=$i%$cate_num;
    			if($i%$cate_num==0)
    			{
    				$picInfo[$i]['start']=true;
    			}
    			if($i%$cate_num==$cate_num-1||$i==count($picInfo)-1)
    			{
    				$picInfo[$i]['end']=true;
    			}
    	}
    	return $picInfo;
    }
}